package cn.iune.erp.inventory;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
import javax.persistence.Version;

import com.justep.baas.data.RowState;

@Entity
@Table(name="StorageItem",uniqueConstraints={@UniqueConstraint(columnNames={"storageID", "itemID"})})
@NamedQuery(name="StorageItem.findAll", query="SELECT s FROM StorageItem s")
public class StorageItem {

	public StorageItem() {

	}
	
	@Id
	@Column(length=36)
	private String fID;
	
	//库位ID
	@Column(length=32)
	private String storageID;
	@Column(length=32)
	private String itemID;
	//仓库ID
	@Column(length=32)
	private String storehouseID;
	
	private int upperShelf = 0;//上架
	
	////////////////////////////////////物料档案临时数据////////////////////
	@Transient
	@Column(length=32)
	private String fParent;
	@Transient
	private int configType = 0;//可配置物料
	
	@Transient
	@Column(length=30)
	private String itemNo;
	@Transient
	private String itemDescribe;
	@Transient
	@Column(length=512)
	private String itemProperty;
	@Transient
	@Column(length=100)
	private String itemName;
	@Transient
	@Column(length=20)
	private String unitName;
	
	@Transient
	@Column(length=1)
	private String process;
	@Transient
	@Column(length=10)
	private String processLabel;

	@Transient
	@Column(length=1)
	private String forSale;
	@Transient
	@Column(length=1)
	private String forUsed;
	
	@Transient
	private int qualityType = 0;
	@Transient
	@Column(length=10)
	private String qualityTypeLabel = "0:免检,1:抽检,2:全检";
	@Transient
	private int qualityPeriod = 0;//0,不启用保质期管理；1，启用
	@Transient
	private int validDays = 0;
	@Transient
	private int checkoutAgainDays = 0;
	@Transient
	@Column(length=20)
	private String storeNo;
	
	@Transient
	@Column(length=20,columnDefinition="VARCHAR(20) default '********************' COMMENT '批号'")
	private String batchNo;
	
	@Transient
	@Column(precision=10,scale=2,columnDefinition="DECIMAL(10,2) default 0",nullable=false)
	private BigDecimal taxRate = BigDecimal.ZERO;
	
	//采购
	private int purchaseTaxType = 1;//税种：0：不含税，1：含税
//	@Column(length=10)
//	private String taxTypeLabel = "1.应税内含";
	@Column(precision=38,scale=6)
	private BigDecimal purchasePrice = BigDecimal.ZERO;
	//销售
	private int saleTaxType = 1;//税种：0：不含税，1：含税
//	@Column(length=10)
//	private String saxTypeLabel = "1.应税内含";
	@Column(precision=38,scale=6)
	private BigDecimal salePrice = BigDecimal.ZERO;
	//委外
	private int processTaxType = 1;//税种：0：不含税，1：含税
//	@Column(length=10)
//	private String paxTypeLabel = "1.应税内含";
	@Column(precision=38,scale=6)
	private BigDecimal processPrice = BigDecimal.ZERO;

	@Transient
	@Column(precision=10,scale=2)
	private BigDecimal itemWeight = BigDecimal.ZERO;
	@Transient
	@Column(length=20)
	private String itemSize;
	
	@Transient
	@Column(precision=10,scale=2)
	private BigDecimal orderWeight = BigDecimal.ZERO;
	@Transient
	@Column(length=20)
	private String orderSize;
	
	@Transient
	@Column(length=256)
	private String imageurl;
	
	@Transient
	@Column(length=1024)
	private String images;
	
	@Transient
	@Column(length=32)
	String itemClassID;
	
	@Transient
	private int costingType = 2;//成本计价方式
	
	@Transient
	@Column(length=30)
	private String barcode;
	
	//////////////////////////////////////////////////////////////////
	
	////////////////////////////////////仓库档案临时数据////////////////////

	@Transient
	@Column(length=3)
	private String storageType;
	@Transient
	@Column(length=20)
	private String storageTypeLabel;
	
	//仓库ID
//	@Transient
//	@Column(length=32)
//	String rootID;

	@Transient
	@Column(length=32)
	String storageNo;
	@Transient
	@Column(length=20)
	String storageName;
	@Transient
	@Column(length=128)
	private String floorNo;
	
	@Transient
	@Column(length=32)
	private String factoryID;
	@Transient
	@Column(length=15)
	private String factoryNo;
	@Transient
	@Column(length=20)
	private String factoryName;
	
	//////////////////////////////////////////////////////////////////

	
	@Column(precision=10,scale=2,columnDefinition="DECIMAL(10,2) default 0",nullable=false)
	private BigDecimal minQuantity;
	@Column(precision=10,scale=2,columnDefinition="DECIMAL(10,2) default 0",nullable=false)
	private BigDecimal maxQuantity;
	private Date dateIn;
	private Date dateOut;

	@Column(precision=10,scale=2,columnDefinition="DECIMAL(10,2) default 0",nullable=false)
//	private BigDecimal quantityL = BigDecimal.ZERO; //库存数量	
	private BigDecimal itemQuantityL = BigDecimal.ZERO;
	@Column(precision=10,scale=2,columnDefinition="DECIMAL(10,2) default 0",nullable=false)
	private BigDecimal itemQuantityFrozen = BigDecimal.ZERO; //冻结数量。为销售订单预留数量	
	@Column(precision=10,scale=2,columnDefinition="DECIMAL(10,2) default 0",nullable=false)
	private BigDecimal pieceQuantityL = BigDecimal.ZERO;
	@Column(precision=10,scale=2,columnDefinition="DECIMAL(10,2) default 0",nullable=false)
	private BigDecimal pieceQuantityFrozen = BigDecimal.ZERO; //冻结数量。为销售订单预留数量	

	//库存金额
	@Column(precision=38,scale=2,columnDefinition="DECIMAL(38,2) default 0",nullable=false)
	private BigDecimal costingAmount = BigDecimal.ZERO;
	@Transient
	//单位成本
	@Column(precision=38,scale=6)
	private BigDecimal costingAmountPer;
	
	//单位标准成本
	@Transient
	@Column(precision=38,scale=6)
	private BigDecimal materialStandardPer = BigDecimal.ZERO;
	@Transient
	@Column(precision=38,scale=6)
	private BigDecimal workingStandardPer = BigDecimal.ZERO;
	@Transient
	@Column(precision=38,scale=6)
	private BigDecimal manufactStandardPer = BigDecimal.ZERO;
	@Transient
	@Column(precision=38,scale=6)
	private BigDecimal processStandardPer = BigDecimal.ZERO;
	
	private Timestamp createDatetime;
	
	@Column(length=65)
	private String userId;

	@Column(length=128)
	private String enterpriseNo;
	@Column(length=128)
	private String enterpriseName;

	@Version
//	private int version = 0;
	private long version;
	
	@Transient//非持久字段
	private RowState rowState;
	public RowState getRowState() {
		return rowState;
	}
	public void setRowState(RowState rowState) {
		this.rowState = rowState;
	}
	public long getVersion() {
		return version;
	}
	public void setVersion(long version) {
		this.version = version;
	}





	public BigDecimal getPieceQuantityL() {
		return pieceQuantityL;
	}

	public void setPieceQuantityL(BigDecimal pieceQuantity) {
		this.pieceQuantityL = pieceQuantity;
	}

	public BigDecimal getCostingAmount() {
		return costingAmount;
	}

	public void setCostingAmount(BigDecimal costingAmount) {
		this.costingAmount = costingAmount;
	}

	public BigDecimal getCostingAmountPer() {
		return costingAmountPer;
	}

	public void setCostingAmountPer(BigDecimal costingAmountPer) {
		this.costingAmountPer = costingAmountPer;
	}

	public String getfID() {
		return fID;
	}
	public void setfID(String fID) {
		this.fID = fID;
	}

	public Date getDateIn() {
		return dateIn;
	}

	public void setDateIn(Date dateIn) {
		this.dateIn = dateIn;
	}

	public Date getDateOut() {
		return dateOut;
	}

	public void setDateOut(Date dateOut) {
		this.dateOut = dateOut;
	}

	public BigDecimal getMinQuantity() {
		return minQuantity;
	}

	public void setMinQuantity(BigDecimal minQuantity) {
		this.minQuantity = minQuantity;
	}

	public BigDecimal getMaxQuantity() {
		return maxQuantity;
	}

	public void setMaxQuantity(BigDecimal maxQuantity) {
		this.maxQuantity = maxQuantity;
	}


	public BigDecimal getItemQuantityL() {
		return itemQuantityL;
	}
	public void setItemQuantityL(BigDecimal itemQuantityL) {
		this.itemQuantityL = itemQuantityL;
	}
	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getEnterpriseNo() {
		return enterpriseNo;
	}

	public void setEnterpriseNo(String enterpriseNo) {
		this.enterpriseNo = enterpriseNo;
	}

	public String getEnterpriseName() {
		return enterpriseName;
	}

	public void setEnterpriseName(String enterpriseName) {
		this.enterpriseName = enterpriseName;
	}

	public String getStorageID() {
		return storageID;
	}
	public void setStorageID(String storageID) {
		this.storageID = storageID;
	}
	public String getItemID() {
		return itemID;
	}
	public void setItemID(String itemID) {
		this.itemID = itemID;
	}
	public String getItemProperty() {
		return itemProperty;
	}
	public void setItemProperty(String itemProperty) {
		this.itemProperty = itemProperty;
	}
	public String getBatchNo() {
		return batchNo;
	}
	public void setBatchNo(String batchNo) {
		this.batchNo = batchNo;
	}
	public String getItemNo() {
		return itemNo;
	}
	public void setItemNo(String itemNo) {
		this.itemNo = itemNo;
	}
	public String getItemDescribe() {
		return itemDescribe;
	}
	public void setItemDescribe(String itemDescribe) {
		this.itemDescribe = itemDescribe;
	}
	public String getItemName() {
		return itemName;
	}
	public void setItemName(String itemName) {
		this.itemName = itemName;
	}
	public String getUnitName() {
		return unitName;
	}
	public void setUnitName(String unitName) {
		this.unitName = unitName;
	}
	public int getQualityType() {
		return qualityType;
	}
	public void setQualityType(int qualityType) {
		this.qualityType = qualityType;
	}
	public String getQualityTypeLabel() {
		return qualityTypeLabel;
	}
	public void setQualityTypeLabel(String qualityTypeLabel) {
		this.qualityTypeLabel = qualityTypeLabel;
	}
	public int getQualityPeriod() {
		return qualityPeriod;
	}
	public void setQualityPeriod(int qualityPeriod) {
		this.qualityPeriod = qualityPeriod;
	}
	public int getValidDays() {
		return validDays;
	}
	public void setValidDays(int validDays) {
		this.validDays = validDays;
	}
	public int getCheckoutAgainDays() {
		return checkoutAgainDays;
	}
	public void setCheckoutAgainDays(int checkoutAgainDays) {
		this.checkoutAgainDays = checkoutAgainDays;
	}
	public String getStoreNo() {
		return storeNo;
	}
	public void setStoreNo(String storeNo) {
		this.storeNo = storeNo;
	}
	public BigDecimal getTaxRate() {
		return taxRate;
	}
	public void setTaxRate(BigDecimal taxRate) {
		this.taxRate = taxRate;
	}
	public BigDecimal getItemWeight() {
		return itemWeight;
	}
	public void setItemWeight(BigDecimal itemWeight) {
		this.itemWeight = itemWeight;
	}
	public String getItemSize() {
		return itemSize;
	}
	public void setItemSize(String itemSize) {
		this.itemSize = itemSize;
	}
	public BigDecimal getOrderWeight() {
		return orderWeight;
	}
	public void setOrderWeight(BigDecimal orderWeight) {
		this.orderWeight = orderWeight;
	}
	public String getOrderSize() {
		return orderSize;
	}
	public void setOrderSize(String orderSize) {
		this.orderSize = orderSize;
	}
	public String getImages() {
		return images;
	}
	public void setImages(String images) {
		this.images = images;
	}
	public String getItemClassID() {
		return itemClassID;
	}
	public void setItemClassID(String itemClassID) {
		this.itemClassID = itemClassID;
	}
	public String getStorageType() {
		return storageType;
	}
	public void setStorageType(String storageType) {
		this.storageType = storageType;
	}
	public String getStorageTypeLabel() {
		return storageTypeLabel;
	}
	public void setStorageTypeLabel(String storageTypeLabel) {
		this.storageTypeLabel = storageTypeLabel;
	}
	public String getFloorNo() {
		return floorNo;
	}
	public void setFloorNo(String floorNo) {
		this.floorNo = floorNo;
	}
	public String getFactoryID() {
		return factoryID;
	}
	public void setFactoryID(String factoryID) {
		this.factoryID = factoryID;
	}
	public String getFactoryNo() {
		return factoryNo;
	}
	public void setFactoryNo(String factoryNo) {
		this.factoryNo = factoryNo;
	}
	public String getFactoryName() {
		return factoryName;
	}
	public void setFactoryName(String factoryName) {
		this.factoryName = factoryName;
	}
	public String getProcess() {
		return process;
	}
	public void setProcess(String process) {
		this.process = process;
	}
	public String getProcessLabel() {
		return processLabel;
	}
	public void setProcessLabel(String processLabel) {
		this.processLabel = processLabel;
	}
	public String getForSale() {
		return forSale;
	}
	public void setForSale(String forSale) {
		this.forSale = forSale;
	}
	public String getForUsed() {
		return forUsed;
	}
	public void setForUsed(String forUsed) {
		this.forUsed = forUsed;
	}
	public String getStorageNo() {
		return storageNo;
	}
	public void setStorageNo(String storageNo) {
		this.storageNo = storageNo;
	}
	public String getStorageName() {
		return storageName;
	}
	public void setStorageName(String storageName) {
		this.storageName = storageName;
	}
	public Timestamp getCreateDatetime() {
		return createDatetime;
	}
	public void setCreateDatetime(Timestamp createDatetime) {
		this.createDatetime = createDatetime;
	}
	public BigDecimal getSalePrice() {
		return salePrice;
	}
	public void setSalePrice(BigDecimal salePrice) {
		this.salePrice = salePrice;
	}
	public String getBarcode() {
		return barcode;
	}
	public void setBarcode(String barcode) {
		this.barcode = barcode;
	}
	public String getfParent() {
		return fParent;
	}
	public void setfParent(String fParent) {
		this.fParent = fParent;
	}
	public String getImageurl() {
		return imageurl;
	}
	public void setImageurl(String imageurl) {
		this.imageurl = imageurl;
	}
	public int getConfigType() {
		return configType;
	}
	public void setConfigType(int configType) {
		this.configType = configType;
	}
	public int getUpperShelf() {
		return upperShelf;
	}
	public void setUpperShelf(int upperShelf) {
		this.upperShelf = upperShelf;
	}
	public BigDecimal getItemQuantityFrozen() {
		return itemQuantityFrozen;
	}
	public void setItemQuantityFrozen(BigDecimal itemQuantityFrozen) {
		this.itemQuantityFrozen = itemQuantityFrozen;
	}
	public BigDecimal getPieceQuantityFrozen() {
		return pieceQuantityFrozen;
	}
	public void setPieceQuantityFrozen(BigDecimal pieceQuantityFrozen) {
		this.pieceQuantityFrozen = pieceQuantityFrozen;
	}
	public String getStorehouseID() {
		return storehouseID;
	}
	public void setStorehouseID(String storehouseID) {
		this.storehouseID = storehouseID;
	}
	public int getCostingType() {
		return costingType;
	}
	public void setCostingType(int costingType) {
		this.costingType = costingType;
	}
	public int getPurchaseTaxType() {
		return purchaseTaxType;
	}
	public void setPurchaseTaxType(int purchaseTaxType) {
		this.purchaseTaxType = purchaseTaxType;
	}
	public BigDecimal getPurchasePrice() {
		return purchasePrice;
	}
	public void setPurchasePrice(BigDecimal purchasePrice) {
		this.purchasePrice = purchasePrice;
	}
	public int getSaleTaxType() {
		return saleTaxType;
	}
	public void setSaleTaxType(int saleTaxType) {
		this.saleTaxType = saleTaxType;
	}
	public int getProcessTaxType() {
		return processTaxType;
	}
	public void setProcessTaxType(int processTaxType) {
		this.processTaxType = processTaxType;
	}
	public BigDecimal getProcessPrice() {
		return processPrice;
	}
	public void setProcessPrice(BigDecimal processPrice) {
		this.processPrice = processPrice;
	}
	public BigDecimal getMaterialStandardPer() {
		return materialStandardPer;
	}
	public void setMaterialStandardPer(BigDecimal materialStandardPer) {
		this.materialStandardPer = materialStandardPer;
	}
	public BigDecimal getWorkingStandardPer() {
		return workingStandardPer;
	}
	public void setWorkingStandardPer(BigDecimal workingStandardPer) {
		this.workingStandardPer = workingStandardPer;
	}
	public BigDecimal getManufactStandardPer() {
		return manufactStandardPer;
	}
	public void setManufactStandardPer(BigDecimal manufactStandardPer) {
		this.manufactStandardPer = manufactStandardPer;
	}
	public BigDecimal getProcessStandardPer() {
		return processStandardPer;
	}
	public void setProcessStandardPer(BigDecimal processStandardPer) {
		this.processStandardPer = processStandardPer;
	}


}